public class String_test2 {
    public static void main(String[] args) {
        String name = "张磊Test1";
        System.out.println(name.length());
        char surname = name.charAt(0);
        System.out.println(surname);

        for(int i = 0; i < name.length(); ++i) {
            System.out.print(name.charAt(i));
        }

        System.out.println("---------------");
        String name2 = "张磊Test1";
        if (name2.equals(name)) {
            System.out.println("相等");
        } else {
            System.out.println("不相等");
        }

        System.out.println("-----------");
        String c1 = "A1bbc";
        String c2 = "a1BBC";
        System.out.println(c1.equals(c2));
        System.out.println(c1.equalsIgnoreCase(c2));
        String s = "张磊Test1";
        System.out.println(s.substring(0, 2));
        System.out.println(s.substring(2));
        String info = "垃圾垃圾哈哈哈";
        info = info.replace("垃圾", "**");
        System.out.println(info);
        System.out.println("---------------------");
        String info2 = "张磊学Java哈哈哈";
        System.out.println(info2.contains("Java"));
        System.out.println(info2.contains("java"));
        String name5 = "王小黑";
        if (name5.startsWith("王")) {
            System.out.println("以王开头");
        } else {
            System.out.println("不以王开头");
        }

        System.out.println("--------------------------------");
        String info3 = "王一黑,王二黑,王三黑,王四黑";
        String[] info4 = info3.split(",");

        for(int i = 0; i < info4.length; ++i) {
            System.out.println(info4[i]);
        }

    }
    }

